package com.sqj;

import java.util.HashMap;
import java.util.Map;

public class ChannelPay implements IChannelPay{
    private Map<String,IChannelPay> map=new HashMap<>();
    public ChannelPay(){
        map.put("ali",new AliPay());
        map.put("wechat",new WechatPay());
    }
    @Override
    public PayResult pay(OrderInfo orderInfo) {
        return map.get(orderInfo.getPayChannel()).pay(orderInfo);
    }
}
